﻿@using SH = EMoney.IStock.Client.Framework.StringHelper;

@using EMoney.IStock.Client.Models.Boot;

@{
    Layout = null;

    int tdCount = 0;
    int tableWidth = 0;
    List<UserFunc> lstUserFunc = ViewBag.UserFunc;

    if (lstUserFunc != null && lstUserFunc.Count >= 0)
    {
        tdCount = lstUserFunc.Count;
        tableWidth = 242 * tdCount;
    }

    string strTableWidth = string.Concat(tableWidth, "px;");

    string Sid = ViewBag.Sid;
}
<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>启动画面</title>
    <link rel="stylesheet" type="text/css" href="@SH.GetStaticFile("IStockClientStatic/boot/css/common.css?v=20140822")" id="linkcss" />
    <script src="http://static.emoney.cn/js/libs/jquery.min.1.8.3.js" type="text/javascript"></script>
</head>
<body>
    <div id="startView">
       <table class="table" cellspacing="0" cellpadding="0" border="0">
           <tbody>
               <tr><td class="paside pa_l">
                   <div class="sect">
                        <div class="p_i">
                            @{
                                if (ViewBag.BigEvent != null)
                                {
                                    <div class="pTit"><span class="lnbx ptpck"><span class="lnbx ptxt">@ViewBag.BigEvent.typename</span></span></div>
                                   <div class="hotpic">
                                       <img src="@ViewBag.BigEvent.imgurl" alt="" style="width:233px;height:178px;" />
                                   </div>
                                   <div class="tinf" >
                                       <h2>事件点评 》</h2>
                                       <div class="tdiscrib">
                                           @SH.StringSubstrLen(ViewBag.BigEvent.message, 150)
                                       </div>
                                       <div class="subln">
                                           <a href="javascript:;" class="btn bigevent"> 所有大事件 </a>
                                       </div>
                                   </div>
                                }
                                }
                        </div>
                   </div>
                   </td><td class="pmiddle">
                       <div class="sect">
                          <div class="p_i p_i_bg" id="slidBox">
                              <div class="cnt">
                                    <table class="sctab" style="width:@strTableWidth"><tbody><tr>
                                        @{
                                            if (lstUserFunc != null && lstUserFunc.Count > 0)
                                            {
                                                string fucimg = string.Empty;
                                                //string title = string.Empty;

                                                foreach (EMoney.IStock.Client.Models.Boot.UserFunc userFunc in lstUserFunc)
                                                {
                                                    //title = string.Concat("查看", userFunc.FuncName, "学习课程");
                                                    fucimg = SH.GetStaticFile(string.Concat("IStockClientStatic/boot/images/func_icon/",userFunc.FuncID,".png"));
                                                    
                                                    <td>
                                                            <div class="tbx">
                                                      <div class="tit"> <b> 周 周 有 惊 喜 </b>
                                                                      <i>无需签到  &nbsp; 无需点赞</i></div>
                                                      <div class="proinf">
                                                          <div class="proicon">  
                                                              <img src="@fucimg" alt=""/>
                                                          </div>
                                                              @{
                                                                  switch (userFunc.Type)
                                                                    {
                                                                        case 1:
                                                                            <h1><a href="javascript:;" onclick="ISTOCK_FUNC_GOFUNC('@userFunc.FuncID');return false;" class="funcname">@userFunc.FuncName</a></h1>
                                                                            <span class="lnbx" style="color:#A1A1A1;">价值：
                                                                                <span style="text-decoration:line-through;">@userFunc.MarketPrice 元/年</span>
                                                                                </span>
                                                                            break;
                                                                        default:
                                                                            <h1><a href="javascript:;" onclick="checkFunc('@Sid','@userFunc.FuncID');" class="funcname">@userFunc.FuncName</a></h1>
                                                                            <span class="lnbx" style="color:#A1A1A1;">价值：
                                                                                <span>@userFunc.MarketPrice 元/年</span>
                                                                            </span>
                                                                            break; 
                                                                    }
                                                                  }                                                         
                                                      </div>
                                                          @{
                                                            switch (userFunc.Type)
                                                            {
                                                                case 1:
                                                                    <div class="tips tipBlue curW" remain="@userFunc.Remain" funcid="@userFunc.FuncID">
                                                                        <div class="tip_i tip_l curWT"><span><b style="font-weight:normal;">本周免费，剩余 @userFunc.Remain 天</b></span></div><i class="pointer"></i>
                                                                    </div>
                                                                    break;
                                                                case 2:
                                                                    <div class="tips">
                                                                        <div class="tip_i tip_l"><span id="preWeek" flag="@userFunc.FuncID"> 上周赠送，已过期 <a href="http://i.emoney.cn/promotion/redirect?type=shop&sid=@Sid&token=xxx&funcid=@userFunc.FuncID&from=open" target="_blank">还要使用</a></span></div><i class="pointer"></i>
                                                                    </div>
                                                                    break;
                                                                case 3:
                                                                    <div class="tips">
                                                                        <div class="tip_i tip_l"><span id="ppreWeek" flag="@userFunc.FuncID"> 上上周赠送，已过期 <a href="http://i.emoney.cn/promotion/redirect?type=shop&sid=@Sid&token=xxx&funcid=@userFunc.FuncID&from=open" target="_blank">还要使用</a></span></div><i class="pointer"></i>
                                                                    </div>
                                                                    break;
                                                                default:
                                                                    break;
                                                            }
                                                            }
                                                      </div></td>
                                                }
                                            }
                                            }
                                        </tr></tbody></table>      
                              </div>
                              <div class="pageLn">
                                  @{
                                      if(tdCount > 1)
                                      {
                                      for (int i = 0; i < tdCount; i++)
                                      {
                                          if (i == 0)
                                          {
                                            <a href="javascript:;" class="on"></a>
                                          }
                                          else
                                          {
                                              <a href="javascript:;"></a>
                                          }
                                      }
                                      }
                                      }
                              </div>
                          </div>
                       </div>
                        </td><td class="paside pa_r">
                            <div class="sect">
                                <div class="p_i">
                                    @{
                                        if (ViewBag.Weather != null)
                                        {
                                            <div class="r1">仓位建议 <span class="holdpos">@SH.FormatDecimal(ViewBag.Weather.posi, "0")%</span></div>
                                            <div class="r2">短期策略：@ViewBag.Weather.short_strategy<br />
                                                中期策略：@ViewBag.Weather.long_strategy
                                            </div>
                                        }
                                        }
                                        <div class="r3">
                                            <h2>强势板块：</h2>
                                            <div class="hotbk">
                                                @{
                                                    if (ViewBag.QsRs != null && ViewBag.QsRs.qsbk != null && ViewBag.QsRs.qsbk.Count > 0)
                                                    {
                                                        int bkcount = 0;
                                                        foreach (EMoney.IStock.Client.Models.Boot.StockIDName bk in ViewBag.QsRs.qsbk)
                                                        {
                                                            if (bkcount >= 2)
                                                            {
                                                                break;
                                                            }
                                                            <a href="javascript:;" class="qsbk" bkid="@bk.stockid">@bk.name</a>
                                                            bkcount++;
                                                        }
                                                    }
                                                    }
                                            </div>
                                        </div>                                                                            
                                    <div class="r4">
                                        <h2>热门个股</h2>
                                        <div>
                                            <ul id="ulHotStock"></ul>
                                        </div>
                                    </div>
                                </div>
                            </div>
                             </td></tr>
           </tbody>
       </table>
    </div>
    <form id="goForm" action="http://i.emoney.cn/promotion/redirect" method="get" target="_blank">
        <input type="hidden" id="type" name="type" value="shop" />
        <input type="hidden" id="token" name="token" value="xxx"/>
        <input type="hidden" id="from" name="from" value="open"/>
        <input type="hidden" id="sid" name="sid" />
        <input type="hidden" id="funcid" name="funcid" />
    </form>
    <input type="hidden" id="hidHotStock" value="@ViewBag.HotStock" />
    <script src="@SH.GetStaticFile("IStockClientStatic/js/istockfunc.js")" type="text/javascript"></script>
    <script type="text/javascript">
        var hotStocks = "";
        $(document).ready(function () {
            $(function () {
                var $slidBox = $("#slidBox"),
                    $slidCnt = $(".cnt", $slidBox),
                    $ctrlDot = $(".pageLn a", $slidBox);

                $ctrlDot.hover(function () {
                    $(this).addClass("on").siblings().removeClass("on");
                    var idx = $ctrlDot.index(this);
                    $slidCnt.stop(true, true).animate({ "scrollLeft": (242 * idx) + "px" }, 100, "", function () {
                    });
                });
            });

            $(".bigevent").click(function () {
                ISTOCK_FUNC_HOTKEY("02");
            });

            $(".qsbk").click(function () {
                var curbkid = "2" + $(this).attr("bkid");

                GroupToKLine("强势板块", curbkid, curbkid);
            });

            $("#ulHotStock").delegate('.hotstock', 'click', '', function () {
                var curCode = $(this).attr("code");

                if (curCode != undefined && curCode != "") {
                    GroupToKLine("热门个股", curCode, hotStocks);
                }
            }).delegate(".hotstock", "mouseenter", function () {
                $(this).find(".stknam").addClass("underline");
                $(this).find(".stkcod").addClass("underline");
            }).delegate(".hotstock", "mouseleave", function () {
                $(this).find(".stknam").removeClass("underline");
                $(this).find(".stkcod").removeClass("underline");
            });

            $(".funcname").hover(function () {
                $(this).addClass("namehover");
            }, function () {
                $(this).removeClass("namehover");
            });

            $(".curW").click(function () {
                ISTOCK_FUNC_GOFUNC($(this).attr("funcid"));
            });

            $(".curW").hover(function () {
                $(this).css("cursor", "pointer");
                $(this).find(".curWT").css("background-color", "#1C75BC");
                $(this).find(".pointer").css("border-bottom-color", "#1C75BC");
                $(this).find(".curWT").html("<span><b style=\"font-weight:normal;\">立即免费使用</b></span>");
            }, function () {
                $(this).css("cursor", "none");
                $(this).find(".curWT").css("background-color", "#5BACD9");
                $(this).find(".pointer").css("border-bottom-color", "#5BACD9");
                $(this).find(".curWT").html("<span><b style=\"font-weight:normal;\">本周免费，剩余 " + $(this).attr("remain") + " 天</b></span>");
            });

            initWeekTips();

            initHotStock();
        });

        function initWeekTips() {
            var preFuncid = $("#preWeek").attr("flag");

            var flag = ISTOCK_FUNC_CHECKFUNC(preFuncid);

            if (flag == true) {
                $("#preWeek").html("上周赠送，已结束");
            }

            var ppreFuncid = $("#ppreWeek").attr("flag");

            flag = ISTOCK_FUNC_CHECKFUNC(ppreFuncid);

            if (flag == true) {
                $("#ppreWeek").html("上上周赠送，已结束");
            }
        }

        function initHotStock() {
            var hotStock = $("#hidHotStock").val();

            if (hotStock != undefined && hotStock != "") {
                var html = "", hotStockCount = 0;;
                var arrHotStock = hotStock.split(",");

                for (var i = 0; i < arrHotStock.length; i++) {
                    if (arrHotStock[i] == undefined || arrHotStock[i] == "") {
                        continue;
                    }
                    if (hotStockCount >= 8) {
                        break;
                    }

                    hotStocks += arrHotStock[i] + ",";
                    html += "<li style='cursor:pointer;' class='hotstock' code='" + arrHotStock[i] + "'><span class=\"stknam\">" + ISTOCK_FUNC_GETSECUABBR(arrHotStock[i]) + "</span><span class=\"stkcod\">" + formatSecucode(arrHotStock[i]) + "</span></li>";
                    hotStockCount++;
                }

                $("#ulHotStock").html(html);
            }
        }

        function formatSecucode(secucode) {
            if (secucode != "" && secucode.length == 7) {
                return secucode.substr(1, 6);
            }
            else {
                return secucode;
            }
        }

        function checkFunc(sid, funcid) {
            var flag = ISTOCK_FUNC_CHECKFUNC(funcid);

            if (flag == true) {
                ISTOCK_FUNC_GOFUNC(funcid);
            }
            else {
                $("#sid").val(sid);
                $("#funcid").val(funcid);

                $("#goForm").submit();
            }
        }
    </script>
</body>
</html>